import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtSpreadLinkIpVO, JqtSpreadLinkIpForm, JqtSpreadLinkIpQuery } from '@/api/bus/jqtSpreadLinkIp/types';

/**
 * 查询推广链接ip列表
 * @param query
 * @returns {*}
 */

export const listJqtSpreadLinkIp = (query?: JqtSpreadLinkIpQuery): AxiosPromise<JqtSpreadLinkIpVO[]> => {
  return request({
    url: '/bus/jqtSpreadLinkIp/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询推广链接ip详细
 * @param id
 */
export const getJqtSpreadLinkIp = (id: string | number): AxiosPromise<JqtSpreadLinkIpVO> => {
  return request({
    url: '/bus/jqtSpreadLinkIp/' + id,
    method: 'get'
  });
};

/**
 * 新增推广链接ip
 * @param data
 */
export const addJqtSpreadLinkIp = (data: JqtSpreadLinkIpForm) => {
  return request({
    url: '/bus/jqtSpreadLinkIp',
    method: 'post',
    data: data
  });
};

/**
 * 修改推广链接ip
 * @param data
 */
export const updateJqtSpreadLinkIp = (data: JqtSpreadLinkIpForm) => {
  return request({
    url: '/bus/jqtSpreadLinkIp',
    method: 'put',
    data: data
  });
};

/**
 * 删除推广链接ip
 * @param id
 */
export const delJqtSpreadLinkIp = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtSpreadLinkIp/' + id,
    method: 'delete'
  });
};

/**
 * 保存推广链接ip
 * @param data
 */
export const saveLinksIp = (data: any) => {
  return request({
    url: '/api/jqtSpreadLinkIp',
    method: 'post',
    data: data
  });
};
